<!DOCTYPE html>
<html>
<head>
    <title>生成图标</title>
</head>
<body>
    <canvas id="icon16" width="16" height="16"></canvas>
    <canvas id="icon48" width="48" height="48"></canvas>
    <canvas id="icon128" width="128" height="128"></canvas>
    <script>
        function drawIcon(canvas) {
            const ctx = canvas.getContext('2d');
            const size = canvas.width;
            
            // 绘制背景
            ctx.fillStyle = '#4CAF50';
            ctx.beginPath();
            ctx.arc(size/2, size/2, size/2, 0, Math.PI * 2);
            ctx.fill();
            
            // 绘制股票图标
            ctx.fillStyle = 'white';
            ctx.beginPath();
            ctx.moveTo(size/2, size/4);
            ctx.lineTo(size*3/4, size/2);
            ctx.lineTo(size*2/3, size/2);
            ctx.lineTo(size*2/3, size*3/4);
            ctx.lineTo(size/3, size*3/4);
            ctx.lineTo(size/3, size/2);
            ctx.lineTo(size/4, size/2);
            ctx.closePath();
            ctx.fill();
            
            // 绘制底部线条
            ctx.beginPath();
            ctx.moveTo(size/3, size*3/4);
            ctx.lineTo(size*2/3, size*3/4);
            ctx.strokeStyle = 'white';
            ctx.lineWidth = size/24;
            ctx.stroke();
        }
        
        // 为每个画布绘制图标
        ['icon16', 'icon48', 'icon128'].forEach(id => {
            const canvas = document.getElementById(id);
            drawIcon(canvas);
            
            // 创建下载链接
            const link = document.createElement('a');
            link.download = `${id}.png`;
            link.href = canvas.toDataURL('image/png');
            link.textContent = `下载 ${id}.png`;
            document.body.appendChild(link);
            document.body.appendChild(document.createElement('br'));
        });
    </script>
</body>
</html> 